var longestCommonPrefix = function(strs) {
  let res = ""
  let [a, ...b] = strs
  for (let i in a){
    let passed = b.every(item => item[i] === a[i])
    if(passed) res += a[i]
    else break
  }
  return res
}